const api = require('../../utils/api')
Component({
    options:{
        styleIsolation: 'isolated'
    },
    properties:{
        obj:Object,
        buttonList:Object,
        showStatus:Boolean,
        line: {
            type:Boolean,
            value:true
        }
    },
    data:{
        ifHave:null,
    },
    methods:{
        goDetail(){
            wx.navigateTo({
              url: `../../pages/detail/index?id=${this.properties.obj.productid}`,
            })
        },
        handleCartCancel(){
            let pages = getCurrentPages();
            
            let clientid = wx.getStorageSync('id')
            let that = this
            let id = that.properties.obj.id
            let obj = {
                opcode: "Int16Array", 
                id:id
            }
            api.collectiondel({
                data:obj,
                method:'post',
                success: function(res){
                    if(res.data.success){
                        wx.showToast({
                          title: '取消成功',
                        })
                        if(pages.length>1){
                            pages[1].getproList(clientid)
                        }else{
                            pages[0].getOrderList(clientid)
                        }
                        
                    }else{
                        wx.showToast({
                            title: '取消失败',
                          })
                          if(pages.length>1){
                            // pages[1].getproList(clientid)
                        }else{

                        }
                    }
                }
            })
        },
    },
    ready(){
       this.properties.line=true
    }
})